﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
//using LTP.Accounts.Bus;
namespace xxxy.Web.userInfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtuserNum.Text.Trim().Length==0)
			{
				strErr+="教工号不能为空！\\n";	
			}
			if(this.txtuserName.Text.Trim().Length==0)
			{
				strErr+="用户姓名不能为空！\\n";	
			}
			if(this.txtusex.Text.Trim().Length==0)
			{
				strErr+="性别不能为空！\\n";	
			}
			if(this.txtuserPwd.Text.Trim().Length==0)
			{
				strErr+="用户密码不能为空！\\n";	
			}
			if(this.txtuseridnumber.Text.Trim().Length==0)
			{
				strErr+="身份证号不能为空！\\n";	
			}
			if(this.txtubanknumber.Text.Trim().Length==0)
			{
				strErr+="银行卡号不能为空！\\n";	
			}
			if(this.txtuphone.Text.Trim().Length==0)
			{
				strErr+="个人电话不能为空！\\n";	
			}
			if(this.txtutel.Text.Trim().Length==0)
			{
				strErr+="办公电话不能为空！\\n";	
			}
			if(this.txtuemail.Text.Trim().Length==0)
			{
				strErr+="邮箱不能为空！\\n";	
			}
			if(this.txtuqq.Text.Trim().Length==0)
			{
				strErr+="QQ号不能为空！\\n";	
			}
			if(this.txtudegree1.Text.Trim().Length==0)
			{
				strErr+="第一学历不能为空！\\n";	
			}
			if(this.txtuxuwei1.Text.Trim().Length==0)
			{
				strErr+="第一学位不能为空！\\n";	
			}
			if(this.txtumajor1.Text.Trim().Length==0)
			{
				strErr+="专业1不能为空！\\n";	
			}
			if(this.txtuschool1.Text.Trim().Length==0)
			{
				strErr+="毕业学校不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtugratime1.Text))
			{
				strErr+="毕业时间格式错误！\\n";	
			}
			if(this.txtudegree2.Text.Trim().Length==0)
			{
				strErr+="最后学历不能为空！\\n";	
			}
			if(this.txtuxuwei2.Text.Trim().Length==0)
			{
				strErr+="最后学位不能为空！\\n";	
			}
			if(this.txtumajor2.Text.Trim().Length==0)
			{
				strErr+="专业不能为空！\\n";	
			}
			if(this.txtuschool2.Text.Trim().Length==0)
			{
				strErr+="毕业学校不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtugratime2.Text))
			{
				strErr+="毕业时间格式错误！\\n";	
			}
			if(this.txtuposition.Text.Trim().Length==0)
			{
				strErr+="职位不能为空！\\n";	
			}
			if(this.txtutitle.Text.Trim().Length==0)
			{
				strErr+="职称不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtujobtime.Text))
			{
				strErr+="参加工作时间格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtuiscomputer.Text))
			{
				strErr+="是否信息学院教工格式错误！\\n";	
			}
			if(this.txtuserRemarks.Text.Trim().Length==0)
			{
				strErr+="备注不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtuserLevel.Text))
			{
				strErr+="用户级别是管理员还是教师格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string userNum=this.txtuserNum.Text;
			string userName=this.txtuserName.Text;
			string usex=this.txtusex.Text;
			string userPwd=this.txtuserPwd.Text;
			string useridnumber=this.txtuseridnumber.Text;
			string ubanknumber=this.txtubanknumber.Text;
			string uphone=this.txtuphone.Text;
			string utel=this.txtutel.Text;
			string uemail=this.txtuemail.Text;
			string uqq=this.txtuqq.Text;
			string udegree1=this.txtudegree1.Text;
			string uxuwei1=this.txtuxuwei1.Text;
			string umajor1=this.txtumajor1.Text;
			string uschool1=this.txtuschool1.Text;
			DateTime ugratime1=DateTime.Parse(this.txtugratime1.Text);
			string udegree2=this.txtudegree2.Text;
			string uxuwei2=this.txtuxuwei2.Text;
			string umajor2=this.txtumajor2.Text;
			string uschool2=this.txtuschool2.Text;
			DateTime ugratime2=DateTime.Parse(this.txtugratime2.Text);
			string uposition=this.txtuposition.Text;
			string utitle=this.txtutitle.Text;
			DateTime ujobtime=DateTime.Parse(this.txtujobtime.Text);
			int uiscomputer=int.Parse(this.txtuiscomputer.Text);
			string userRemarks=this.txtuserRemarks.Text;
			int userLevel=int.Parse(this.txtuserLevel.Text);

			xxxy.Model.userInfo model=new xxxy.Model.userInfo();
			model.userNum=userNum;
			model.userName=userName;
			model.usex=usex;
			model.userPwd=userPwd;
			model.useridnumber=useridnumber;
			model.ubanknumber=ubanknumber;
			model.uphone=uphone;
			model.utel=utel;
			model.uemail=uemail;
			model.uqq=uqq;
			model.udegree1=udegree1;
			model.uxuwei1=uxuwei1;
			model.umajor1=umajor1;
			model.uschool1=uschool1;
			model.ugratime1=ugratime1;
			model.udegree2=udegree2;
			model.uxuwei2=uxuwei2;
			model.umajor2=umajor2;
			model.uschool2=uschool2;
			model.ugratime2=ugratime2;
			model.uposition=uposition;
			model.utitle=utitle;
			model.ujobtime=ujobtime;
			model.uiscomputer=uiscomputer;
			model.userRemarks=userRemarks;
			model.userLevel=userLevel;

			xxxy.BLL.userInfo bll=new xxxy.BLL.userInfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
